Scale and Rotate Images

The following example displays an original image (left) and uses methods to scale and rotate the visualization (right).

Original image of galaxy Galaxy is bigger and rotated 270 degrees

 

Copy these lines and paste them into the IDL command line to run:

; Select the file.

file = FILEPATH('galaxy.dat', $

   SUBDIRECTORY=['examples', 'data'])

 

; Use the READ_BINARY function to read in the data.

; specifying the data dimensions.

galaxy = READ_BINARY(file, DATA_DIMS = [256, 256])

 

; Use the IMAGE function to display the image

; with a color table.

im = IMAGE(galaxy, RGB_TABLE = 4)

 

; Rotate the image by 270 degrees clockwise.

im.ROTATE, -270

 

; Zoom in on the image by a factor of 1.5.

im.SCALE, 1.5, 1.5

 

You can also control the image display using the toolbar in the Graphics window.

Note: This example uses data files from the IDL examples/data directory of your IDL installation. Two files in that directory, data.txt and index.txt, contain descriptions of the files, including array sizes.

Resources